/**
 * 
 */
package it.unical.canonaco.rende.igpe.game.cbv.logiclayer.engine.netgame;

import org.json.simple.JSONObject;

import it.unical.canonaco.rende.igpe.game.cbv.logiclayer.engine.events.GenericEvent;

/**
 * @author Massimo Canonaco
 *
 */
public class StartMatchEvent implements GenericEvent
{
	/** */
	static public final float GUID = 19391;
	
	/** */
	private String otherPlayer;
	
	/** */
	private String startPlayer;
	
	@Override
	public float getGUID() 
	{
		return GUID;
	}

	@Override
	public String getName() 
	{
		return "startMatchEvent";
	}

	public StartMatchEvent()
	{
		
	}
	
	public StartMatchEvent(String start, String other)
	{
		startPlayer = start;
		otherPlayer = other;
	}
	
	@SuppressWarnings("unchecked")
	@Override
	public JSONObject getAsJSONObject() 
	{
		JSONObject object = new JSONObject();
		object.put(GLOBAL_GUID_KEY, GUID);
		object.put(START_KEY, startPlayer);
		object.put(OTHER_KEY, otherPlayer);
		return object;
	}

	@Override
	public void setFromJSONOnbject(JSONObject object) 
	{
		startPlayer = (String) object.get(START_KEY);
		otherPlayer = (String) object.get(OTHER_KEY);
	}
	static private final String START_KEY = "start";
	static private final String OTHER_KEY = "other";

	/**
	 * @return the otherPlayer
	 */
	public String getOtherPlayer() {
		return otherPlayer;
	}

	/**
	 * @param otherPlayer the otherPlayer to set
	 */
	public void setOtherPlayer(String otherPlayer) {
		this.otherPlayer = otherPlayer;
	}

	/**
	 * @return the startPlayer
	 */
	public String getStartPlayer() {
		return startPlayer;
	}

	/**
	 * @param startPlayer the startPlayer to set
	 */
	public void setStartPlayer(String startPlayer) {
		this.startPlayer = startPlayer;
	}
}
